package com.lyz.dataStructure.zijietiaodong;/**
 * @Author:759057893@qq.com Lyz
 * @Date: ${Date} 20:36
 * @Description:
 **/

import java.util.Scanner;

/**
 * @Author:759057893@qq.com Lyz
 * @Date: 2019/4/17 20:36
 * @Description:
 **/
class Test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine();
            Test1 t = new Test1();
            System.out.println(t.lengthOfLongestSubstring(s));
        }
    }

    public int lengthOfLongestSubstring(String s) {
        int n = s.length(), ans = 0;
        int[] index = new int[128]; // current index of character
        for (int j = 0, i = 0; j < n; j++) {
            i = Math.max(index[s.charAt(j)], i);
            ans = Math.max(ans, j - i + 1);
            index[s.charAt(j)] = j + 1;
        }
        return ans;
    }
}

